// CountryMapper.java (数据访问层)
package com.ywb.mapper;

import com.ywb.pojo.Country;
import com.ywb.pojo.CountryQueryParam;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface CountryMapper {

    @Select("SELECT * FROM country ORDER BY country_id")
    List<Country> findAll();

    @Delete("DELETE FROM country WHERE country_id = #{id}")
    void deleteById(Integer id);

    @Insert("INSERT INTO country(country_name, continent) VALUES(#{countryName}, #{continent})")
    void insert(Country country);

    @Select("SELECT * FROM country WHERE country_id = #{id}")
    Country getById(Integer id);

    @Update("UPDATE country SET country_name = #{countryName}, continent = #{continent} WHERE country_id = #{countryId}")
    void update(Country country);

    List<Country> list(CountryQueryParam countryQueryParam);
}